package com.attilax.net;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;

import com.google.common.base.Joiner;
import com.google.common.collect.Lists;

public class urlUtils {
	
	public static void main(String[] args) {
		
	}

	public static String encodeURI(String destinationUri) {
		List li=Lists.newArrayList();
		   String[] a=destinationUri.split("/");
		   for (String string : a) {
			try {
				li.add(  URLEncoder.encode(string, "utf8") );
			} catch (UnsupportedEncodingException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		String join = Joiner.on("/").join(li);
		join=join.replaceAll("%3A", ":");
		
		return join;
	}

}
